<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><!-- InstanceBegin template="/Templates/Function Info.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>WinXAddAccelerator</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<style type="text/css">
<!--
.style3 {font-size: medium}
-->
</style>

<link href="../../WinXStyles.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {
	font-size: x-large;
	font-family: Verdana, Arial, Helvetica, sans-serif;
}
.style2 {
	font-size: large;
	font-family: Verdana, Arial, Helvetica, sans-serif;
}
-->
</style>
</head>

<body>
<h1 class="style1"><img src="../../WinX48.png" width="48" height="48" align="absmiddle"> <!-- InstanceBeginEditable name="title" -->WinXAddAccelerator<!-- InstanceEndEditable --></h1>
<hr>

<!-- InstanceBeginEditable name="Prototype" -->
<p>WinXAddAccelerator (ACCEL accel[], cmd, key, control, alt, shift)</p>
<!-- InstanceEndEditable --><!-- InstanceBeginEditable name="Description" -->
<p>Adds a keyboard accelerator to an accelerator array </p>
<!-- InstanceEndEditable -->
<table width="80%" border="1" cellpadding="0" cellspacing="0">
  <tr bgcolor="#CCCCCC">
    <th width="24%"><span class="style3">Parameter</span></th>
    <th width="76%"><span class="style3">Description</span></th>
  </tr>
  <!-- InstanceBeginRepeat name="Parameter Table" --><!-- InstanceBeginRepeatEntry -->
  <tr bgcolor="#E8E8E8">
    <td><!-- InstanceBeginEditable name="Parameter" -->ACCEL accel[]<!-- InstanceEndEditable --></td>
    <td><!-- InstanceBeginEditable name="Description" -->The array to add the accelerator to <!-- InstanceEndEditable --></td>
  </tr>
  <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
  <tr bgcolor="#E8E8E8">
    <td><!-- InstanceBeginEditable name="Parameter" -->cmd<!-- InstanceEndEditable --></td>
    <td><!-- InstanceBeginEditable name="Description" -->The command the accelerator will trigger <!-- InstanceEndEditable --></td>
  </tr>
  <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
  <tr bgcolor="#E8E8E8">
    <td><!-- InstanceBeginEditable name="Parameter" -->key<!-- InstanceEndEditable --></td>
    <td><!-- InstanceBeginEditable name="Description" -->The VK code of the base key of this accelerator. For standard alphanumeric keys just use a char constant <!-- InstanceEndEditable --></td>
  </tr>
  <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
  <tr bgcolor="#E8E8E8">
    <td><!-- InstanceBeginEditable name="Parameter" -->control<!-- InstanceEndEditable --></td>
    <td><!-- InstanceBeginEditable name="Description" -->$$TRUE to enable the Control modifier <!-- InstanceEndEditable --></td>
  </tr>
  <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
  <tr bgcolor="#E8E8E8">
    <td><!-- InstanceBeginEditable name="Parameter" -->alt<!-- InstanceEndEditable --></td>
    <td><!-- InstanceBeginEditable name="Description" -->$$TRUE to enable the Alt modifer <!-- InstanceEndEditable --></td>
  </tr>
  <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
  <tr bgcolor="#E8E8E8">
    <td><!-- InstanceBeginEditable name="Parameter" -->shift<!-- InstanceEndEditable --></td>
    <td><!-- InstanceBeginEditable name="Description" -->$$TRUE to enable the Shift modifier <!-- InstanceEndEditable --></td>
  </tr>
  <!-- InstanceEndRepeatEntry --><!-- InstanceEndRepeat -->
</table>
<h3>Returns</h3>
<!-- InstanceBeginEditable name="Return Info" -->
<p>$$TRUE on success or $$FALSE on fail </p>
<!-- InstanceEndEditable -->
<h3>Remarks</h3>
<!-- InstanceBeginEditable name="Remarks" -->
<p>accel[] is an array of ACCEL structures. You do not need to initialise this array before calling WinXAddAccelerator. You can convert the ACCEL array into an accelerator table with the CreateAcceleratorTableA Win32API function. Note that assuming the ACCEL array starts with no elements; it will contain 1 element for every accelerator you added with this function. To use the accelerators, pass the accelerator tabled generated by the CreateAcceleratorTableA function into the <a href="WinXDoEvents.htm">WinXDoEvents</a> function. Whenever the user presses the appropriate key combination, the onCommand callback is invoked with the id parameter set the the cmd of the accelerator.</p>
<!-- InstanceEndEditable -->
<h3>Examples</h3>
<table width="80%"  border="0">
  <tr>
    <td bgcolor="#C6C6FF"><!-- InstanceBeginEditable name="Example Code" -->
      <p class="codeStyle">ACCEL accel[]</p>
      <p class="codeStyle">... </p>
      <p class="codeStyle">' Create an accelerator table<br>
        ' F1
        <br>
      WinXAddAccelerator (@accel[], $$CMD_HELP, $$VK_F1, $$FALSE, $$FALSE, $$FALSE)<br>
      ' Ctrl+S
      <br>
      WinXAddAccelerator (@accel[], $$CMD_SAVE, 'S', $$TRUE, $$FALSE, $$FALSE)</p>
      <p class="codeStyle">hAccelerators = CreateAcceleratorTableA (&amp;accel[], UBOUND(accel[])+1)      </p>
    <!-- InstanceEndEditable --></td>
  </tr>
</table>

<h2 class="style2">Related Links</h2>
<!-- InstanceBeginEditable name="Related Links" -->
<p><a href="WinXDoEvents.htm">WinXDoEvents</a></p>
<!-- InstanceEndEditable -->
</body>
<!-- InstanceEnd --></html>
